﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WFcontrol
{
    public partial class sukienchuot : Form
    {
        public sukienchuot()
        {
            InitializeComponent();
        }
        Graphics gl;
        int X_D, Y_D;
        Boolean flag = false;

        private void button1_MouseEnter(object sender, EventArgs e)
        {
            button1.Image = global::WFcontrol.Properties.Resources.eminem_16;
        }

        private void button1_MouseLeave(object sender, EventArgs e)
        {
            button1.Image = global::WFcontrol.Properties.Resources.graffiti_1;
        }

        private void button1_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)

                MessageBox.Show("left");
            else
                if (e.Button == MouseButtons.Right)
                {
                    //int x_t = this.PointToScreen(new Point(e.X, e.Y)).X;
                    //int Y_t = this.PointToScreen(new Point(e.X, e.Y)).Y;
                    contextMenuStrip1.Show(this.button1, e.X, e.Y);
                    //MessageBox.Show("right");
                }
                else
                    MessageBox.Show("middle");
         
        }

        private void sukienchuot_MouseDown(object sender, MouseEventArgs e)
        {
            if (!flag)
            {
                X_D = e.X;
                Y_D = e.Y;
                flag = true;
            }
            //if (e.Button == MouseButtons.Right)
            //    contextMenuStrip1.Show(this, e.X, e.Y);
        }

        private void sukienchuot_Load(object sender, EventArgs e)
        {
            gl = this.CreateGraphics();
        }

        private void button1_MouseDown(object sender, MouseEventArgs e)
        {
           
        }

        private void button1_MouseMove(object sender, MouseEventArgs e)
        {
            
        }

        private void sukienchuot_MouseUp(object sender, MouseEventArgs e)
        {
            flag = false;
        }

        private void sukienchuot_MouseMove(object sender, MouseEventArgs e)
        {
            if (flag == true) {
                gl.Clear(this.BackColor);
                Pen p = new Pen(Brushes.Red, 4);
                gl.DrawEllipse(p, X_D, Y_D, e.X, e.Y);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
        }
    }
}
